///:SwaggerConfig.java
package com.cqgcxy.oes.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.Collections;

/**
 * @author icechen1219
 * @date 2019/12/30
 */
@WebAppConfiguration
@EnableSwagger2
@EnableWebMvc
@ComponentScan(basePackages = "com.maxcore.controller")
public class SwaggerConfig {
    @Bean
    public Docket customDocket() {
        //
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                // api扫描根包
                .apis(RequestHandlerSelectors.basePackage("com.cqgcxy.oes.web"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        // 作者基本信息
        Contact contact = new Contact("icechen1219", "https://gitee.com/weyoungtech", "saga8406@gmail.com");
        // 大标题 title
        return new ApiInfo("在线考试系统API接口",
                // 小标题
                "Swagger测试demo",
                // 版本
                "0.0.1",
                // 相关的网站
                "https://swagger.io/",
                contact,
                // 许可名称
                "MIT License",
                // 许可的全文
                "https://gitee.com/weyoungtech/oes-demo/blob/master/LICENSE",
                Collections.emptyList()
        );
    }


}
///:SwaggerConfig.java
